{% extends 'users/space/base.html' %}

{% block title %}
	{{ user.username }}的文章
{% endblock %}

{% block space-external %}
{% endblock %}

{% block space-main %}
	<div class="user-space-content-box">
		{% if not mixed %}
			<div class="alert alert-warning">该用户还没有发表过文章</div>
		{% else %}
			<div class="user-space-content-box-header">
				<h4 class="text-center">TA的文章</h4>
			</div>
			<div class="user-space-content-box-body">
				{% for post in mixed %}
					{% if post.class_name == 'DepartmentPost' %}
						<div class="user-space-content-box-body-box">
							<h4><a href="{% url 'departments:department_post_info' post.id %}" target="_blank">{{ post.title }}</a></h4>
							<div class="row" style="margin-bottom: 10px;">
								<div class="col-sm-6">
									<span class="glyphicon glyphicon-globe"></span><span>{{ post.department.name }}</span>
								</div>
								<div class="col-sm-6">
									<span class="glyphicon glyphicon-calendar"></span><span>{{ post.created_time|date:'Y-m-d' }}</span>
								</div>
							</div>
							<p>{{ post.desc }}</p>
						</div>
					{% else %}
						<div class="user-space-content-box-body-box">
							<h4><a href="{% url 'departments:association_post_info' post.id %}" target="_blank">{{ post.title }}</a></h4>
							<div class="row" style="margin-bottom: 10px;">
								<div class="col-sm-6">
									<span class="glyphicon glyphicon-globe"></span><span>{{ post.association.name }}</span>
								</div>
								<div class="col-sm-6">
									<span class="glyphicon glyphicon-calendar"></span><span>{{ post.created_time|date:'Y-m-d' }}</span>
								</div>
							</div>
							<p>{{ post.desc }}</p>
						</div>
					{% endif %}
				{% endfor %}
			</div>
		{% endif %}
	</div>
{% endblock %}
